package com.xxxx;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.api.java.operators.UnionOperator;

/**
 * 批量数据处理
 */
public class Hello07FlinkeOperatorUnion {
    public static void main(String[] args) throws Exception {
        //获取执行环境
        ExecutionEnvironment environment = ExecutionEnvironment.getExecutionEnvironment();
        //获取数据源
        DataSource<Integer> source1 = environment.fromElements(1, 2, 3, 4, 5, 6, 7, 8);
        DataSource<Integer> source2 = environment.fromElements(11, 22, 33, 44, 55, 66, 77, 88);
        DataSource<Integer> source3 = environment.fromElements(111, 222, 333, 444, 555, 666, 777, 888);
        DataSource<String> source4 = environment.fromElements("aa", "bb", "cc");
        //将三个数据流拼接到一起
        UnionOperator<Integer> source = source1.union(source2).union(source3);

        source.map(num -> num * 10).print();


    }
}
